/* 
* @Author: anchen
* @Date:   2018-12-31 10:08:15
* @Last Modified by:   anchen
* @Last Modified time: 2018-12-31 15:52:41
*/
$(function () {

});

function searchData() {


    var table = layui.table, layer = layui.layer;

    table.init('serviceTable',{
        data: [
            {
                id:1,
                "TYSHXYDM": "5144****2XB",
                "SHTTMC": "广东**学会",
                "CLSJ": "1993-06-08",
                "BGSX": "业务范围",
                "BGQ": "卫生经济研究",
                "BGH": "（见纸质材料）"
            },
            {
                id:2,
                "TYSHXYDM": "5144****2XB",
                "SHTTMC": "广东**学会",
                "CLSJ": "1993-06-08",
                "BGSX": "业务范围",
                "BGQ": "卫生经济研究",
                "BGH": "（见纸质材料）"
            }
        ]
        , toolbar: true
        , title: '社会团体变更信息'
        , page: true
    });

    //监听行工具事件
    table.on('tool(serviceTable)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值

        if (layEvent === 'detail') {
            loadDetail(data.id)
        }
    });
}

function loadDetail(id) {
    var data = [
            {
                "BGH": "（见纸质材料）",
                "LXDH": "020-838***33",
                "BGSX": "业务范围",
                "LXR": "饶**",
                "GXSJ": "2015-01-28",
                "BGRQ": "2015-01-28",
                "SHTTMC": "广东**学会",
                "TYSHXYDM": "5144****2XB",
                "BGLY": "",
                "BGQ": "卫生经济研究",
                "CLSJ": "1993-06-08"
            },
            {
                "BGH": "广州市**大厦1502室",
                "LXDH": "020-838***33",
                "BGSX": "住所",
                "LXR": "饶**",
                "GXSJ": "2017-10-19",
                "BGRQ": "2017-10-19",
                "SHTTMC": "广东省**学会",
                "TYSHXYDM": "514400***2XB",
                "BGLY": "业务变更",
                "BGQ": "广州市**4栋3楼",
                "CLSJ": "1993-06-08"
            }

    ];


    var data0 = data[parseInt(id) - 1];

    $('#detailD').html(template('detailDS',{data:data0}))
    layer.open({
        type: 1,
        content: $("#detail"),
        area: ['900px', '550px'],
        title: '社会团体变更信息',
        maxmin: true,
        shade: 0,
        cancel: function () {
            $("#detail").hide()
        }
    });


}